#include"head.h"


void FindSname(Information s[], int n, char varname[])/*查询姓名*/
{
	fflush(stdin); 
	printf("请输入想要查询的姓名： ");
	gets(varname); 

	Calculate(s, n);
	int flag;
	for (int i = 0; i < n; i++)
	{
		
		if (strcmp(s[i].name, varname)==0)
		{
			flag=1;
			printf("姓名:\t性别:\t出生日期:\t参加工作日期:\t所属部门:\t人员类别:\t技术等级:\t技术职称:\t文化程度:\t民族:\t籍贯:\t现住地址:\n");
			printf("%-8s%-8s%-16s%d.%d.%-16d%-12s%-16s%-16s%-16s%-16s%-8s%-8s%s\n",varname,s[i].gender,s[i].birth,s[i].startwork_year,s[i].startwork_month,s[i].startwork_day,s[i].section,s[i].personnelcategory,s[i].grade,s[i].titles,s[i].culturestandard,s[i].nation,s[i].nativeplace,s[i].Address);
			break;	
			
		}
	} 	
	if(flag!=1)
	{
		printf("未找到！\n");
	}
	
	int flag1;
	for (int i = 0; i < n; i++)
	{
		
		if (strcmp(s[i].name, varname)==0)
		{
			flag1=1;
			printf("基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t房租:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款\t加班费用:\t夜班费用:\t病假系数:\n");
			printf("%-16d%-16d%-16d%-16d%-16d%-8d%-16lf%-16d%-16d%-16d%-16d%-16d%-16lf\n",s[i].base,s[i].job,s[i].price,s[i].post,s[i].live,s[i].chummage,s[i].sick,s[i].thing*s[i].busy_thing,s[i].free*s[i].free_work,s[i].other,s[i].overtime,s[i].night_differential,s[i].sickleave_coefficient);
		}                                                                                                                                                                                                                                                                                         
	}
	if(flag1!=1)
	{
		printf("未找到！\n");
	}
	
	int flag2;
	for (int i  = 0; i < n ; i++)
	{
		if (strcmp(s[i].name, varname)==0)
		{	
			flag2=1;
			printf("出勤天数:\t工伤天数:\t产假天数:\t病假天数:\t旷工天数:\t事假天数:\t加班天数:\t夜班天数:\n");
			printf("%-16d%-16d%-16d%-16d%-16d%-16d%-16d%-16d\n",s[i].work,s[i].injury,s[i].maternityleave,s[i].ill,s[i].free_work,s[i].busy_thing,s[i].add_work,s[i].night);                                                                                                                                                               
		}
	}
	
	if (flag2!=1)
	{
		printf("未找到！\n");
	}
		
	return ;
}